package com.skt.exception;

public class UserException extends BaseException {

    public UserException(ErrorCode errorCode) {
        super(errorCode);
    }

    public UserException(int code, String message) {
        super(code, message);
    }

    public UserException(ErrorCode errorCode, String customMessage) {
        super(errorCode, customMessage);
    }

    // ========== 用户信息相关快速创建方法 ==========
    public static UserException userNotFound() {
        return new UserException(UserErrorCode.USER_NOT_FOUND);
    }

    public static UserException userUpdateFailed() {
        return new UserException(UserErrorCode.USER_UPDATE_FAILED);
    }

    public static UserException userOperationConflict() {
        return new UserException(UserErrorCode.USER_OPERATION_CONFLICT);
    }

    // ========== 个人资料更新相关快速创建方法 ==========
    public static UserException usernameAlreadyExists() {
        return new UserException(UserErrorCode.USERNAME_ALREADY_EXISTS);
    }

    public static UserException emailAlreadyExists() {
        return new UserException(UserErrorCode.EMAIL_ALREADY_EXISTS);
    }

    public static UserException phoneAlreadyExists() {
        return new UserException(UserErrorCode.PHONE_ALREADY_EXISTS);
    }

    public static UserException realNameTooLong() {
        return new UserException(UserErrorCode.REAL_NAME_TOO_LONG);
    }

    public static UserException usernameTooShort() {
        return new UserException(UserErrorCode.USERNAME_TOO_SHORT);
    }



    // ========== 通用创建方法 ==========
    public static UserException of(ErrorCode errorCode) {
        return new UserException(errorCode);
    }

    public static UserException of(ErrorCode errorCode, String customMessage) {
        return new UserException(errorCode, customMessage);
    }

    public static UserException of(int code, String message) {
        return new UserException(code, message);
    }
}